package com.dyz.model;

import java.util.Comparator;

class MyCompare implements Comparator<Invoice> {

	@Override
	public int compare(Invoice af1, Invoice af2) {

		Integer d1, d2, m1, m2, n1, n2, y;

		d1 = af1.d;
		d2 = af2.d;
		m1 = af1.m;
		m2 = af2.m;
		
		n1 = af1.getInvCount();
		n2 = af2.getInvCount();
		
		int x = m1.compareTo(m2);
		y = d1.compareTo(d2);

		if (x == 0) {
			if (y == 0)
				return n1.compareTo(n2);
			else return y;
		} else
			return x;
		


	}
}
